/****************************************************************************************
This file is part of Proactive Investigator Analytics.

Proactive Investigator Analytics is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Proactive Investigator Analytics is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Proactive Investigator Analytics.  If not, see <http://www.gnu.org/licenses/>.

This script creates DHCP partition function, partition scheme, tables and indexes
on partition scheme, and indexed view.

****************************************************************************************/

USE RiskSecurityDW
GO

/****** Object:  PartitionFunction [DHCP_JulJunDayDateRangePF]    Script Date: 05/09/2011 14:52:19 ******/
CREATE PARTITION FUNCTION [DHCP_JulJunDayDateRangePF](datetime) AS RANGE FOR VALUES (N'2011-01-01T00:00:00.000', N'2011-01-02T00:00:00.000', 
N'2011-01-03T00:00:00.000', 
N'2011-01-04T00:00:00.000', N'2011-01-05T00:00:00.000', N'2011-01-06T00:00:00.000', N'2011-01-07T00:00:00.000', N'2011-01-08T00:00:00.000', 
N'2011-01-09T00:00:00.000', N'2011-01-10T00:00:00.000', N'2011-01-11T00:00:00.000', N'2011-01-12T00:00:00.000', N'2011-01-13T00:00:00.000', 
N'2011-01-14T00:00:00.000', N'2011-01-15T00:00:00.000', N'2011-01-16T00:00:00.000', N'2011-01-17T00:00:00.000', N'2011-01-18T00:00:00.000', 
N'2011-01-19T00:00:00.000', N'2011-01-20T00:00:00.000', N'2011-01-21T00:00:00.000', N'2011-01-22T00:00:00.000', N'2011-01-23T00:00:00.000', 
N'2011-01-24T00:00:00.000', N'2011-01-25T00:00:00.000', N'2011-01-26T00:00:00.000', N'2011-01-27T00:00:00.000', N'2011-01-28T00:00:00.000', 
N'2011-01-29T00:00:00.000', N'2011-01-30T00:00:00.000', N'2011-01-31T00:00:00.000', N'2011-02-01T00:00:00.000', N'2011-02-02T00:00:00.000', 
N'2011-02-03T00:00:00.000', N'2011-02-04T00:00:00.000', N'2011-02-05T00:00:00.000', N'2011-02-06T00:00:00.000', N'2011-02-07T00:00:00.000', 
N'2011-02-08T00:00:00.000', N'2011-02-09T00:00:00.000', N'2011-02-10T00:00:00.000', N'2011-02-11T00:00:00.000', N'2011-02-12T00:00:00.000', 
N'2011-02-13T00:00:00.000', N'2011-02-14T00:00:00.000', N'2011-02-15T00:00:00.000', N'2011-02-16T00:00:00.000', N'2011-02-17T00:00:00.000', 
N'2011-02-18T00:00:00.000', N'2011-02-19T00:00:00.000', N'2011-02-20T00:00:00.000', N'2011-02-21T00:00:00.000', N'2011-02-22T00:00:00.000', 
N'2011-02-23T00:00:00.000', N'2011-02-24T00:00:00.000', N'2011-02-25T00:00:00.000', N'2011-02-26T00:00:00.000', N'2011-02-27T00:00:00.000', 
N'2011-02-28T00:00:00.000', N'2011-03-01T00:00:00.000', N'2011-03-02T00:00:00.000', N'2011-03-03T00:00:00.000', N'2011-03-04T00:00:00.000', 
N'2011-03-05T00:00:00.000', N'2011-03-06T00:00:00.000', N'2011-03-07T00:00:00.000', N'2011-03-08T00:00:00.000', N'2011-03-09T00:00:00.000', 
N'2011-03-10T00:00:00.000', N'2011-03-11T00:00:00.000', N'2011-03-12T00:00:00.000', N'2011-03-13T00:00:00.000', N'2011-03-14T00:00:00.000', 
N'2011-03-15T00:00:00.000', N'2011-03-16T00:00:00.000', N'2011-03-17T00:00:00.000', N'2011-03-18T00:00:00.000', N'2011-03-19T00:00:00.000', 
N'2011-03-20T00:00:00.000', N'2011-03-21T00:00:00.000', N'2011-03-22T00:00:00.000', N'2011-03-23T00:00:00.000', N'2011-03-24T00:00:00.000', 
N'2011-03-25T00:00:00.000', N'2011-03-26T00:00:00.000', N'2011-03-27T00:00:00.000', N'2011-03-28T00:00:00.000', N'2011-03-29T00:00:00.000', 
N'2011-03-30T00:00:00.000', N'2011-03-31T00:00:00.000', N'2011-04-01T00:00:00.000', N'2011-04-02T00:00:00.000', N'2011-04-03T00:00:00.000', 
N'2011-04-04T00:00:00.000', N'2011-04-05T00:00:00.000', N'2011-04-06T00:00:00.000', N'2011-04-07T00:00:00.000', N'2011-04-08T00:00:00.000', 
N'2011-04-09T00:00:00.000', N'2011-04-10T00:00:00.000', N'2011-04-11T00:00:00.000', N'2011-04-12T00:00:00.000', N'2011-04-13T00:00:00.000', 
N'2011-04-14T00:00:00.000', N'2011-04-15T00:00:00.000', N'2011-04-16T00:00:00.000', N'2011-04-17T00:00:00.000', N'2011-04-18T00:00:00.000', 
N'2011-04-19T00:00:00.000', N'2011-04-20T00:00:00.000', N'2011-04-21T00:00:00.000', N'2011-04-22T00:00:00.000', N'2011-04-23T00:00:00.000', 
N'2011-04-24T00:00:00.000', N'2011-04-25T00:00:00.000', N'2011-04-26T00:00:00.000', N'2011-04-27T00:00:00.000', N'2011-04-28T00:00:00.000', 
N'2011-04-29T00:00:00.000', N'2011-04-30T00:00:00.000', N'2011-05-01T00:00:00.000', N'2011-05-02T00:00:00.000', N'2011-05-03T00:00:00.000', 
N'2011-05-04T00:00:00.000', N'2011-05-05T00:00:00.000', N'2011-05-06T00:00:00.000', N'2011-05-07T00:00:00.000', N'2011-05-08T00:00:00.000', 
N'2011-05-09T00:00:00.000', N'2011-05-10T00:00:00.000', N'2011-05-11T00:00:00.000', N'2011-05-12T00:00:00.000', N'2011-05-13T00:00:00.000', 
N'2011-05-14T00:00:00.000', N'2011-05-15T00:00:00.000', N'2011-05-16T00:00:00.000', N'2011-05-17T00:00:00.000', N'2011-05-18T00:00:00.000', 
N'2011-05-19T00:00:00.000', N'2011-05-20T00:00:00.000', N'2011-05-21T00:00:00.000', N'2011-05-22T00:00:00.000', N'2011-05-23T00:00:00.000', 
N'2011-05-24T00:00:00.000', N'2011-05-25T00:00:00.000', N'2011-05-26T00:00:00.000', N'2011-05-27T00:00:00.000', N'2011-05-28T00:00:00.000', 
N'2011-05-29T00:00:00.000', N'2011-05-30T00:00:00.000', N'2011-05-31T00:00:00.000', N'2011-06-01T00:00:00.000', N'2011-06-02T00:00:00.000', 
N'2011-06-03T00:00:00.000', N'2011-06-04T00:00:00.000', N'2011-06-05T00:00:00.000', N'2011-06-06T00:00:00.000', N'2011-06-07T00:00:00.000', 
N'2011-06-08T00:00:00.000', N'2011-06-09T00:00:00.000', N'2011-06-10T00:00:00.000', N'2011-06-11T00:00:00.000', N'2011-06-12T00:00:00.000', 
N'2011-06-13T00:00:00.000', N'2011-06-14T00:00:00.000', N'2011-06-15T00:00:00.000', N'2011-06-16T00:00:00.000', N'2011-06-17T00:00:00.000', 
N'2011-06-18T00:00:00.000', N'2011-06-19T00:00:00.000', N'2011-06-20T00:00:00.000', N'2011-06-21T00:00:00.000', N'2011-06-22T00:00:00.000', 
N'2011-06-23T00:00:00.000', N'2011-06-24T00:00:00.000', N'2011-06-25T00:00:00.000', N'2011-06-26T00:00:00.000', N'2011-06-27T00:00:00.000', 
N'2011-06-28T00:00:00.000', N'2011-06-29T00:00:00.000', N'2011-06-30T00:00:00.000', N'2011-07-01T00:00:00.000', N'2011-07-02T00:00:00.000', 
N'2011-07-03T00:00:00.000', N'2011-07-04T00:00:00.000', N'2011-07-05T00:00:00.000', N'2011-07-06T00:00:00.000', N'2011-07-07T00:00:00.000', 
N'2011-07-08T00:00:00.000', N'2011-07-09T00:00:00.000', N'2011-07-10T00:00:00.000', N'2011-07-11T00:00:00.000', N'2011-07-12T00:00:00.000', 
N'2011-07-13T00:00:00.000', N'2011-07-14T00:00:00.000', N'2011-07-15T00:00:00.000', N'2011-07-16T00:00:00.000', N'2011-07-17T00:00:00.000', 
N'2011-07-18T00:00:00.000', N'2011-07-19T00:00:00.000', N'2011-07-20T00:00:00.000', N'2011-07-21T00:00:00.000', N'2011-07-22T00:00:00.000', 
N'2011-07-23T00:00:00.000', N'2011-07-24T00:00:00.000', N'2011-07-25T00:00:00.000', N'2011-07-26T00:00:00.000', N'2011-07-27T00:00:00.000', 
N'2011-07-28T00:00:00.000', N'2011-07-29T00:00:00.000', N'2011-07-30T00:00:00.000', N'2011-07-31T00:00:00.000', N'2011-08-01T00:00:00.000', 
N'2011-08-02T00:00:00.000', N'2011-08-03T00:00:00.000', N'2011-08-04T00:00:00.000', N'2011-08-05T00:00:00.000', N'2011-08-06T00:00:00.000', 
N'2011-08-07T00:00:00.000', N'2011-08-08T00:00:00.000', N'2011-08-09T00:00:00.000', N'2011-08-10T00:00:00.000', N'2011-08-11T00:00:00.000', 
N'2011-08-12T00:00:00.000', N'2011-08-13T00:00:00.000', N'2011-08-14T00:00:00.000', N'2011-08-15T00:00:00.000', N'2011-08-16T00:00:00.000', 
N'2011-08-17T00:00:00.000', N'2011-08-18T00:00:00.000', N'2011-08-19T00:00:00.000', N'2011-08-20T00:00:00.000', N'2011-08-21T00:00:00.000', 
N'2011-08-22T00:00:00.000', N'2011-08-23T00:00:00.000', N'2011-08-24T00:00:00.000', N'2011-08-25T00:00:00.000', N'2011-08-26T00:00:00.000', 
N'2011-08-27T00:00:00.000', N'2011-08-28T00:00:00.000', N'2011-08-29T00:00:00.000', N'2011-08-30T00:00:00.000', N'2011-08-31T00:00:00.000', 
N'2011-09-01T00:00:00.000', N'2011-09-02T00:00:00.000', N'2011-09-03T00:00:00.000', N'2011-09-04T00:00:00.000', N'2011-09-05T00:00:00.000', 
N'2011-09-06T00:00:00.000', N'2011-09-07T00:00:00.000', N'2011-09-08T00:00:00.000', N'2011-09-09T00:00:00.000', N'2011-09-10T00:00:00.000', 
N'2011-09-11T00:00:00.000', N'2011-09-12T00:00:00.000', N'2011-09-13T00:00:00.000', N'2011-09-14T00:00:00.000', N'2011-09-15T00:00:00.000', 
N'2011-09-16T00:00:00.000', N'2011-09-17T00:00:00.000', N'2011-09-18T00:00:00.000', N'2011-09-19T00:00:00.000', N'2011-09-20T00:00:00.000', 
N'2011-09-21T00:00:00.000', N'2011-09-22T00:00:00.000', N'2011-09-23T00:00:00.000', N'2011-09-24T00:00:00.000', N'2011-09-25T00:00:00.000', 
N'2011-09-26T00:00:00.000', N'2011-09-27T00:00:00.000', N'2011-09-28T00:00:00.000', N'2011-09-29T00:00:00.000', N'2011-09-30T00:00:00.000', 
N'2011-10-01T00:00:00.000', N'2011-10-02T00:00:00.000', N'2011-10-03T00:00:00.000', N'2011-10-04T00:00:00.000', N'2011-10-05T00:00:00.000', 
N'2011-10-06T00:00:00.000', N'2011-10-07T00:00:00.000', N'2011-10-08T00:00:00.000', N'2011-10-09T00:00:00.000', N'2011-10-10T00:00:00.000', 
N'2011-10-11T00:00:00.000', N'2011-10-12T00:00:00.000', N'2011-10-13T00:00:00.000', N'2011-10-14T00:00:00.000', N'2011-10-15T00:00:00.000', 
N'2011-10-16T00:00:00.000', N'2011-10-17T00:00:00.000', N'2011-10-18T00:00:00.000', N'2011-10-19T00:00:00.000', N'2011-10-20T00:00:00.000', 
N'2011-10-21T00:00:00.000', N'2011-10-22T00:00:00.000', N'2011-10-23T00:00:00.000', N'2011-10-24T00:00:00.000', N'2011-10-25T00:00:00.000', 
N'2011-10-26T00:00:00.000', N'2011-10-27T00:00:00.000', N'2011-10-28T00:00:00.000', N'2011-10-29T00:00:00.000', N'2011-10-30T00:00:00.000', 
N'2011-10-31T00:00:00.000', N'2011-11-01T00:00:00.000', N'2011-11-02T00:00:00.000', N'2011-11-03T00:00:00.000', N'2011-11-04T00:00:00.000', 
N'2011-11-05T00:00:00.000', N'2011-11-06T00:00:00.000', N'2011-11-07T00:00:00.000', N'2011-11-08T00:00:00.000', N'2011-11-09T00:00:00.000', 
N'2011-11-10T00:00:00.000', N'2011-11-11T00:00:00.000', N'2011-11-12T00:00:00.000', N'2011-11-13T00:00:00.000', N'2011-11-14T00:00:00.000', 
N'2011-11-15T00:00:00.000', N'2011-11-16T00:00:00.000', N'2011-11-17T00:00:00.000', N'2011-11-18T00:00:00.000', N'2011-11-19T00:00:00.000', 
N'2011-11-20T00:00:00.000', N'2011-11-21T00:00:00.000', N'2011-11-22T00:00:00.000', N'2011-11-23T00:00:00.000', N'2011-11-24T00:00:00.000', 
N'2011-11-25T00:00:00.000', N'2011-11-26T00:00:00.000', N'2011-11-27T00:00:00.000', N'2011-11-28T00:00:00.000', N'2011-11-29T00:00:00.000', 
N'2011-11-30T00:00:00.000', N'2011-12-01T00:00:00.000', N'2011-12-02T00:00:00.000', N'2011-12-03T00:00:00.000', N'2011-12-04T00:00:00.000', 
N'2011-12-05T00:00:00.000', N'2011-12-06T00:00:00.000', N'2011-12-07T00:00:00.000', N'2011-12-08T00:00:00.000', N'2011-12-09T00:00:00.000', 
N'2011-12-10T00:00:00.000', N'2011-12-11T00:00:00.000', N'2011-12-12T00:00:00.000', N'2011-12-13T00:00:00.000', N'2011-12-14T00:00:00.000', 
N'2011-12-15T00:00:00.000', N'2011-12-16T00:00:00.000', N'2011-12-17T00:00:00.000', N'2011-12-18T00:00:00.000', N'2011-12-19T00:00:00.000', 
N'2011-12-20T00:00:00.000', N'2011-12-21T00:00:00.000', N'2011-12-22T00:00:00.000', N'2011-12-23T00:00:00.000', N'2011-12-24T00:00:00.000', 
N'2011-12-25T00:00:00.000', N'2011-12-26T00:00:00.000', N'2011-12-27T00:00:00.000', N'2011-12-28T00:00:00.000', N'2011-12-29T00:00:00.000', 
N'2011-12-30T00:00:00.000', N'2011-12-31T00:00:00.000', N'2012-01-01T00:00:00.000', N'2012-01-02T00:00:00.000', N'2012-01-03T00:00:00.000', 
N'2012-01-04T00:00:00.000',
N'2012-01-05T00:00:00.000', N'2012-01-06T00:00:00.000', N'2012-01-07T00:00:00.000', N'2012-01-08T00:00:00.000', N'2012-01-09T00:00:00.000', 
N'2012-01-10T00:00:00.000', N'2012-01-11T00:00:00.000', N'2012-01-12T00:00:00.000', N'2012-01-13T00:00:00.000', N'2012-01-14T00:00:00.000', 
N'2012-01-15T00:00:00.000', N'2012-01-16T00:00:00.000', N'2012-01-17T00:00:00.000', N'2012-01-18T00:00:00.000', N'2012-01-19T00:00:00.000', 
N'2012-01-20T00:00:00.000', N'2012-01-21T00:00:00.000', N'2012-01-22T00:00:00.000', N'2012-01-23T00:00:00.000', N'2012-01-24T00:00:00.000', 
N'2012-01-25T00:00:00.000', N'2012-01-26T00:00:00.000', N'2012-01-27T00:00:00.000', N'2012-01-28T00:00:00.000', N'2012-01-29T00:00:00.000', 
N'2012-01-30T00:00:00.000', N'2012-01-31T00:00:00.000', N'2012-02-01T00:00:00.000', N'2012-02-02T00:00:00.000', N'2012-02-03T00:00:00.000', 
N'2012-02-04T00:00:00.000', N'2012-02-05T00:00:00.000', N'2012-02-06T00:00:00.000', N'2012-02-07T00:00:00.000', N'2012-02-08T00:00:00.000', 
N'2012-02-09T00:00:00.000', N'2012-02-10T00:00:00.000', N'2012-02-11T00:00:00.000', N'2012-02-12T00:00:00.000', N'2012-02-13T00:00:00.000', 
N'2012-02-14T00:00:00.000', N'2012-02-15T00:00:00.000', N'2012-02-16T00:00:00.000', N'2012-02-17T00:00:00.000', N'2012-02-18T00:00:00.000', 
N'2012-02-19T00:00:00.000', N'2012-02-20T00:00:00.000', N'2012-02-21T00:00:00.000', N'2012-02-22T00:00:00.000', N'2012-02-23T00:00:00.000', 
N'2012-02-24T00:00:00.000', N'2012-02-25T00:00:00.000', N'2012-02-26T00:00:00.000', N'2012-02-27T00:00:00.000', N'2012-02-28T00:00:00.000', 
N'2012-02-29T00:00:00.000', N'2012-03-01T00:00:00.000', N'2012-03-02T00:00:00.000', N'2012-03-03T00:00:00.000', N'2012-03-04T00:00:00.000', 
N'2012-03-05T00:00:00.000', N'2012-03-06T00:00:00.000', N'2012-03-07T00:00:00.000', N'2012-03-08T00:00:00.000', N'2012-03-09T00:00:00.000', 
N'2012-03-10T00:00:00.000', N'2012-03-11T00:00:00.000', N'2012-03-12T00:00:00.000', N'2012-03-13T00:00:00.000', N'2012-03-14T00:00:00.000', 
N'2012-03-15T00:00:00.000', N'2012-03-16T00:00:00.000', N'2012-03-17T00:00:00.000', N'2012-03-18T00:00:00.000', N'2012-03-19T00:00:00.000', 
N'2012-03-20T00:00:00.000', N'2012-03-21T00:00:00.000', N'2012-03-22T00:00:00.000', N'2012-03-23T00:00:00.000', N'2012-03-24T00:00:00.000', 
N'2012-03-25T00:00:00.000', N'2012-03-26T00:00:00.000', N'2012-03-27T00:00:00.000', N'2012-03-28T00:00:00.000', N'2012-03-29T00:00:00.000', 
N'2012-03-30T00:00:00.000', N'2012-03-31T00:00:00.000', N'2012-04-01T00:00:00.000', N'2012-04-02T00:00:00.000', N'2012-04-03T00:00:00.000', 
N'2012-04-04T00:00:00.000', N'2012-04-05T00:00:00.000', N'2012-04-06T00:00:00.000', N'2012-04-07T00:00:00.000', N'2012-04-08T00:00:00.000', 
N'2012-04-09T00:00:00.000', N'2012-04-10T00:00:00.000', N'2012-04-11T00:00:00.000', N'2012-04-12T00:00:00.000', N'2012-04-13T00:00:00.000', 
N'2012-04-14T00:00:00.000', N'2012-04-15T00:00:00.000', N'2012-04-16T00:00:00.000', N'2012-04-17T00:00:00.000', N'2012-04-18T00:00:00.000', 
N'2012-04-19T00:00:00.000', N'2012-04-20T00:00:00.000', N'2012-04-21T00:00:00.000', N'2012-04-22T00:00:00.000', N'2012-04-23T00:00:00.000', 
N'2012-04-24T00:00:00.000', N'2012-04-25T00:00:00.000', N'2012-04-26T00:00:00.000', N'2012-04-27T00:00:00.000', N'2012-04-28T00:00:00.000', 
N'2012-04-29T00:00:00.000', N'2012-04-30T00:00:00.000', N'2012-05-01T00:00:00.000', N'2012-05-02T00:00:00.000', N'2012-05-03T00:00:00.000', 
N'2012-05-04T00:00:00.000', N'2012-05-05T00:00:00.000', N'2012-05-06T00:00:00.000', N'2012-05-07T00:00:00.000', N'2012-05-08T00:00:00.000', 
N'2012-05-09T00:00:00.000', N'2012-05-10T00:00:00.000', N'2012-05-11T00:00:00.000', N'2012-05-12T00:00:00.000', N'2012-05-13T00:00:00.000', 
N'2012-05-14T00:00:00.000', N'2012-05-15T00:00:00.000', N'2012-05-16T00:00:00.000', N'2012-05-17T00:00:00.000', N'2012-05-18T00:00:00.000', 
N'2012-05-19T00:00:00.000', N'2012-05-20T00:00:00.000', N'2012-05-21T00:00:00.000', N'2012-05-22T00:00:00.000', N'2012-05-23T00:00:00.000', 
N'2012-05-24T00:00:00.000', N'2012-05-25T00:00:00.000', N'2012-05-26T00:00:00.000', N'2012-05-27T00:00:00.000', N'2012-05-28T00:00:00.000', 
N'2012-05-29T00:00:00.000', N'2012-05-30T00:00:00.000', N'2012-05-31T00:00:00.000', N'2012-06-01T00:00:00.000', N'2012-06-02T00:00:00.000', 
N'2012-06-03T00:00:00.000', N'2012-06-04T00:00:00.000', N'2012-06-05T00:00:00.000', N'2012-06-06T00:00:00.000', N'2012-06-07T00:00:00.000', 
N'2012-06-08T00:00:00.000', N'2012-06-09T00:00:00.000', N'2012-06-10T00:00:00.000', N'2012-06-11T00:00:00.000', N'2012-06-12T00:00:00.000', 
N'2012-06-13T00:00:00.000', N'2012-06-14T00:00:00.000', N'2012-06-15T00:00:00.000', N'2012-06-16T00:00:00.000', N'2012-06-17T00:00:00.000', 
N'2012-06-18T00:00:00.000', N'2012-06-19T00:00:00.000', N'2012-06-20T00:00:00.000', N'2012-06-21T00:00:00.000', N'2012-06-22T00:00:00.000', 
N'2012-06-23T00:00:00.000', N'2012-06-24T00:00:00.000', N'2012-06-25T00:00:00.000', N'2012-06-26T00:00:00.000', N'2012-06-27T00:00:00.000', 
N'2012-06-28T00:00:00.000', N'2012-06-29T00:00:00.000', N'2012-06-30T00:00:00.000')


/****** Object:  PartitionScheme [DHCP_JulJunDayDateRangePS]    Script Date: 05/09/2011 14:52:24 ******/
CREATE PARTITION SCHEME [DHCP_JulJunDayDateRangePS] AS PARTITION [DHCP_JulJunDayDateRangePF] ALL TO ([RSDW])
GO

ALTER PARTITION SCHEME [DHCP_JulJunDayDateRangePS] 
NEXT USED [RSDW]
GO

/****** Object:  Table [dbo].[fact_dhcp_9]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[fact_dhcp_9](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_fact_dhcp_9] ON [dbo].[fact_dhcp_9] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO

/****** Object:  Table [dbo].[fact_dhcp_8]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[fact_dhcp_8](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_fact_dhcp_8] ON [dbo].[fact_dhcp_8] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
/****** Object:  Table [dbo].[fact_dhcp_7]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[fact_dhcp_7](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_fact_dhcp_7] ON [dbo].[fact_dhcp_7] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
/****** Object:  Table [dbo].[fact_dhcp_6]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[fact_dhcp_6](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_fact_dhcp_6] ON [dbo].[fact_dhcp_6] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
/****** Object:  Table [dbo].[fact_dhcp_5]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[fact_dhcp_5](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_fact_dhcp_5] ON [dbo].[fact_dhcp_5] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
/****** Object:  Table [dbo].[fact_dhcp_4]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[fact_dhcp_4](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_fact_dhcp_4] ON [dbo].[fact_dhcp_4] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
/****** Object:  Table [dbo].[fact_dhcp_3]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[fact_dhcp_3](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_fact_dhcp_3] ON [dbo].[fact_dhcp_3] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
/****** Object:  Table [dbo].[fact_dhcp_2]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[fact_dhcp_2](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_fact_dhcp_2] ON [dbo].[fact_dhcp_2] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
/****** Object:  Table [dbo].[fact_dhcp_1]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[fact_dhcp_1](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_fact_dhcp_1] ON [dbo].[fact_dhcp_1] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
/****** Object:  Table [dbo].[fact_dhcp_0]    Script Date: 05/09/2011 14:52:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[fact_dhcp_0](
	[date_key] [int] NULL,
	[domain] [char](4) NULL,
	[server] [varchar](100) NULL,
	[event_id] [tinyint] NULL,
	[log-date-time] [datetime] NULL,
	[host_name] [varchar](128) NULL,
	[Description] [varchar](100) NULL,
	[ip_long] [bigint] NULL,
	[ip_addr] [varchar](15) NULL,
	[mac_addr] [varchar](60) NULL,
	[user_name] [varchar](100) NULL,
	[TransactionID] [varchar](50) NULL,
	[QResult] [tinyint] NULL,
	[Probationtime] [varchar](20) NULL,
	[CorrelationID] [varchar](20) NULL,
	[Dhcid] [varchar](20) NULL
) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO
SET ANSI_PADDING OFF
GO
CREATE CLUSTERED INDEX [IX_fact_dhcp_0] ON [dbo].[fact_dhcp_0] 
(
	[log-date-time] DESC
)WITH (DATA_COMPRESSION = PAGE, PAD_INDEX  = ON, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = ON, ALLOW_ROW_LOCKS  = OFF, ALLOW_PAGE_LOCKS  = OFF, FILLFACTOR = 80) ON [DHCP_JulJunDayDateRangePS]([log-date-time])
GO

--Create view
CREATE VIEW [vw_fact_dhcp]
WITH SCHEMABINDING
AS
SELECT	 [date_key]
		,[domain]
		,[server]
		,[event_id]
		,[log-date-time]
		,[host_name]
		,[Description]
		,[ip_long]
		,[ip_addr]
		,[mac_addr]
		,[user_name]
		,[TransactionID]
		,[QResult]
		,[Probationtime]
		,[CorrelationID]
		,[Dhcid]
FROM	[fact_dhcp_0]
WITH (NOLOCK)
UNION ALL
SELECT	 [date_key]
		,[domain]
		,[server]
		,[event_id]
		,[log-date-time]
		,[host_name]
		,[Description]
		,[ip_long]
		,[ip_addr]
		,[mac_addr]
		,[user_name]
		,[TransactionID]
		,[QResult]
		,[Probationtime]
		,[CorrelationID]
		,[Dhcid]
FROM	[fact_dhcp_1]
WITH (NOLOCK)
UNION ALL
SELECT	 [date_key]
		,[domain]
		,[server]
		,[event_id]
		,[log-date-time]
		,[host_name]
		,[Description]
		,[ip_long]
		,[ip_addr]
		,[mac_addr]
		,[user_name]
		,[TransactionID]
		,[QResult]
		,[Probationtime]
		,[CorrelationID]
		,[Dhcid]
FROM	[fact_dhcp_2]
WITH (NOLOCK)
UNION ALL
SELECT	 [date_key]
		,[domain]
		,[server]
		,[event_id]
		,[log-date-time]
		,[host_name]
		,[Description]
		,[ip_long]
		,[ip_addr]
		,[mac_addr]
		,[user_name]
		,[TransactionID]
		,[QResult]
		,[Probationtime]
		,[CorrelationID]
		,[Dhcid]
FROM	[fact_dhcp_3]
WITH (NOLOCK)
UNION ALL
SELECT	 [date_key]
		,[domain]
		,[server]
		,[event_id]
		,[log-date-time]
		,[host_name]
		,[Description]
		,[ip_long]
		,[ip_addr]
		,[mac_addr]
		,[user_name]
		,[TransactionID]
		,[QResult]
		,[Probationtime]
		,[CorrelationID]
		,[Dhcid]
FROM	[fact_dhcp_4]
WITH (NOLOCK)
UNION ALL
SELECT	 [date_key]
		,[domain]
		,[server]
		,[event_id]
		,[log-date-time]
		,[host_name]
		,[Description]
		,[ip_long]
		,[ip_addr]
		,[mac_addr]
		,[user_name]
		,[TransactionID]
		,[QResult]
		,[Probationtime]
		,[CorrelationID]
		,[Dhcid]
FROM	[fact_dhcp_5]
WITH (NOLOCK)
UNION ALL
SELECT	 [date_key]
		,[domain]
		,[server]
		,[event_id]
		,[log-date-time]
		,[host_name]
		,[Description]
		,[ip_long]
		,[ip_addr]
		,[mac_addr]
		,[user_name]
		,[TransactionID]
		,[QResult]
		,[Probationtime]
		,[CorrelationID]
		,[Dhcid]
FROM	[fact_dhcp_6]
WITH (NOLOCK)
UNION ALL
SELECT	 [date_key]
		,[domain]
		,[server]
		,[event_id]
		,[log-date-time]
		,[host_name]
		,[Description]
		,[ip_long]
		,[ip_addr]
		,[mac_addr]
		,[user_name]
		,[TransactionID]
		,[QResult]
		,[Probationtime]
		,[CorrelationID]
		,[Dhcid]
FROM	[fact_dhcp_7]
WITH (NOLOCK)
UNION ALL
SELECT	 [date_key]
		,[domain]
		,[server]
		,[event_id]
		,[log-date-time]
		,[host_name]
		,[Description]
		,[ip_long]
		,[ip_addr]
		,[mac_addr]
		,[user_name]
		,[TransactionID]
		,[QResult]
		,[Probationtime]
		,[CorrelationID]
		,[Dhcid]
FROM	[fact_dhcp_8]
WITH (NOLOCK)
UNION ALL
SELECT	 [date_key]
		,[domain]
		,[server]
		,[event_id]
		,[log-date-time]
		,[host_name]
		,[Description]
		,[ip_long]
		,[ip_addr]
		,[mac_addr]
		,[user_name]
		,[TransactionID]
		,[QResult]
		,[Probationtime]
		,[CorrelationID]
		,[Dhcid]
FROM	[fact_dhcp_9]
WITH (NOLOCK)
GO
